import java.io.File;

public class list_txt {
    public static void main(String[] args) throws Exception{
        File file = new File("I:"+File.separator);
        info(file);
    }
    public static void info(File file){
        File list[] = file.listFiles((f) -> f.isDirectory() ? true:
                f.getName().endsWith(".txt"));
        if (list != null){
            for (File temp:list){
                info(temp);
            }
        }else {
            System.out.println(file);
        }
    }

}
